package com.midea.ai.air.ui.device;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import com.midea.ai.air.R;
import com.midea.ai.air.common.BaseFragment;
import com.midea.ai.air.ui.device.adapter.DeviceGridAdapter;
import com.midea.ai.air.ui.device.data.DeviceGridItem;

import java.util.ArrayList;

/**
 * Created by ouyangdi on 2015/12/10.
 * "家电"页面，家电列表
 */
public class DeviceListFragment extends BaseFragment{
    private ArrayList<DeviceGridItem> mDeviceGridItems;
    private GridView mGridDevice;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initData();
    }

    private void initData() {
        mDeviceGridItems = new ArrayList<>();
        mDeviceGridItems.add(new DeviceGridItem("空调", "客厅", R.drawable.air_appliances_airconditioner));
        mDeviceGridItems.add(new DeviceGridItem("加湿器", "客厅", R.drawable.air_appliances_humidifier));
        mDeviceGridItems.add(new DeviceGridItem("除湿机", "客厅", R.drawable.air_appliances_dehumidifier));
        mDeviceGridItems.add(new DeviceGridItem("净化器", "客厅", R.drawable.air_appliances_purifier));
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_list_device, container, false);
        mGridDevice =(GridView)view.findViewById(R.id.gridView_device);
        mGridDevice.setAdapter(new DeviceGridAdapter(getContext(), 0, mDeviceGridItems));
        return view;
    }
}
